var baseUrl = "https://douban.uieee.com/v2/movie/";
function http(url){
    return new Promise((resolve,reject)=>{
        wx.request({
            url: baseUrl+url,
            data: {},
            header: {'content-type':'application/jsonp'},
            method: 'GET',
            dataType: 'json',
            responseType: 'text',
            success: (res)=>{
                resolve(res.data);
            },
            fail: (err)=>{
                reject(err)
            },
        });
    })
}
module.exports = {
    getTop250(){
        return http("top250");
    },
    getTheaters(){
        return http("in_theaters");
    },
    getComing(){
        return http("coming_soon");
    },
    getMovie(url){
        return http(url);
    },
    getDetail(id){
        return http("subject/"+id);
    }
}